package com.demo.model;

/**
 * UserContext
 *
 * @author liujin
 * @date 2020/12/9 1:13
 */
public class UserContext {

    private static InheritableThreadLocal<UserDto> localUser = new InheritableThreadLocal<>();

    public static final String KEY_USERINFO_IN_HTTP_HEADER = "X-AUTO-FP-USERINFO";

    private UserContext() {
    }

    public static UserDto getUser(){
        return localUser.get();
    }

    public static void setUser(UserDto user){
        localUser.set(user);
    }

    public static void destroy(){
        localUser.remove();
    }

}
